<!---总览数据页面-->
<template>
  <div class="ele-body ele-body-card">
    <a-row>
      <a-col :span="12" class="block-space-right">
        <a-card title="设备信息" class="card-width">
          <a-descriptions bordered :column="1">
            <a-descriptions-item label="巴杀id">{{data.basaId}}</a-descriptions-item>
            <a-descriptions-item label="巴杀设备名字">{{data.basaName}}</a-descriptions-item>
            <a-descriptions-item label="数据更新时间">{{basaRealtimeData.updateTime}}</a-descriptions-item>
            <a-descriptions-item label="关联4G设备">ID：{{data.recordId}} / IMEI：{{data.basaImei}}</a-descriptions-item>
          </a-descriptions>
        </a-card>
      </a-col>
      <a-col :span="12" class="block-space-right">
        <!-- 右边统计快 -->
        <a-card title="实时数据" class="card-width">
          <a-row :gutter="8">
            <a-col :span="12">
              <a-card>
                <a-statistic
                  title="水温"
                  :value="basaRealtimeData.waterTemperature"
                  :precision="1"
                  suffix="℃"
                  class="demo-class"
                  :value-style="{ color: '#cf1322' }"
                />
              </a-card>
            </a-col>
            <a-col :span="12" >
              <a-card>
                <a-statistic
                  title="剩余执行时间"
                  :value="basaRealtimeData.remainTime"
                  :precision="0"
                  suffix="分钟"
                  class="demo-class"
                  :value-style="{ color: '#cf1322' }"
                />
              </a-card>
            </a-col>
          </a-row>
          <a-row :gutter="8">
            <a-col :span="24">
              <a-card>
                <a-statistic
                  title="profile"
                  :value="basaRealtimeData.profile"
                  :precision="1"
                  suffix=""
                  class="demo-class"
                  :value-style="{ color: '#cf1326' }"
                />
              </a-card>
            </a-col>
          </a-row>
        </a-card>
      </a-col>
    </a-row>
    <a-divider orientation="left">命令下发，下发前先connect with Colorstromat命令，再操作其他命令</a-divider>
    <a-row>
      <a-col :span="10" class="block-space-right">
        <a-button type='primary' html-type='button' @click='cancelIOTAuto'>
          取消自动命令查询模式(脚本会定期采集数据)，然后手动下发命令
        </a-button>
      </a-col>
      <a-col :span="10" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addIotAuto'>
          重新开启自动命令查询模式(脚本会定期采集数据)
        </a-button>
      </a-col>
      <a-col :span="2" class="block-space-right" />
    </a-row>

    <a-row style="margin-top: 40px;">
      <a-col :span="6" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(22)' :loading='connectColorstLoading'>
          connect with Colorstromat
        </a-button>
      </a-col>
      <a-col :span="6" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(21)' :loading='disConnectColorstLoading'>
          disconnect with Colorstromat
        </a-button>
      </a-col>
      <a-col :span="12" class="block-space-right" />
    </a-row>
    <a-row style="margin-top: 40px;">
      <a-col :span="4" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(1)' :loading='readVersionLoading'>
          获取版本
        </a-button>
      </a-col>
      <a-col :span="4" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(17)' :loading='readStatusLoading'>
          获取状态
        </a-button>
      </a-col>
      <a-col :span="4" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(18)' :loading='readMalfunctionLoading'>
          故障查询
        </a-button>
      </a-col>
      <a-col :span="4" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(19)' :loading='readWarnningLoading'>
          告警查询
        </a-button>
      </a-col>
      <a-col :span="4" class="block-space-right" >
        <a-button type='primary' html-type='button' @click='addCommandToDevice(2)' :loading='setProfileNoneLoading'>
          cancel profiles
        </a-button>
      </a-col>
      <a-col :span="4" class="block-space-right" />
    </a-row>
    <a-row style="margin-top: 40px;">
      <a-col :span="4" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(3)' :loading='setProfile1StartLoading'>
          Profile1 start
        </a-button>
      </a-col>
      <a-col :span="4" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(4)' :loading='setProfile1StopLoading'>
          Profile1 stop
        </a-button>
      </a-col>
      <a-col :span="4" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(5)' :loading='setProfile2StartLoading'>
          Profile2 start
        </a-button>
      </a-col>
      <a-col :span="4" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(6)' :loading='setProfile2StopLoading'>
          Profile2 stop
        </a-button>
      </a-col>
      <a-col :span="8" class="block-space-right" />
    </a-row>

    <a-row style="margin-top: 40px;">
      <a-col :span="4" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(7)' :loading='setProfile3RampStartLoading'>
          Profile3,Ramp start
        </a-button>
      </a-col>
      <a-col :span="4" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(8)' :loading='setProfile3RampStopLoading'>
          Profile3,Ramp stop
        </a-button>
      </a-col>
      <a-col :span="4" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(9)' :loading='setProfile3FrozenStartLoading'>
          Profile3,Frozen start
        </a-button>
      </a-col>
      <a-col :span="4" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(10)' :loading='setProfile3FrozenStopLoading'>
          Profile3,Frozen stop
        </a-button>
      </a-col>
      <a-col :span="8" class="block-space-right" />
    </a-row>

    <a-row style="margin-top: 40px;">
      <a-col :span="6" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(11)' :loading='setProfile3RefrigeratorStartLoading'>
          Profile3,Refrigerator start
        </a-button>
      </a-col>
      <a-col :span="6" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(12)' :loading='setProfile3RefrigeratorStopLoading'>
          Profile3,Refrigerator stop
        </a-button>
      </a-col>
      <a-col :span="12" class="block-space-right" />
    </a-row>

    <a-row style="margin-top: 40px;">
      <a-col :span="6" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(13)' :loading='setProfile3RoomTemperatureStartLoading'>
          Profile3,Room Temperature start
        </a-button>
      </a-col>
      <a-col :span="6" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(14)' :loading='setProfile3RoomTemperatureStopLoading'>
          Profile3,Room Temperature stop
        </a-button>
      </a-col>
      <a-col :span="12" class="block-space-right" />
    </a-row>

    <a-row style="margin-top: 40px;margin-bottom: 120px;">
      <a-col :span="6" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(15)' :loading='setProfile4StartLoading'>
          Profile4 start
        </a-button>
      </a-col>
      <a-col :span="6" class="block-space-right">
        <a-button type='primary' html-type='button' @click='addCommandToDevice(16)' :loading='setProfile4StopLoading'>
          Profile4 stop
        </a-button>
      </a-col>
      <a-col :span="12" class="block-space-right" />
    </a-row>
  </div>
</template>

<script>
import {BasaRealtimeApi} from "@/api/property/basa/BasaRealtimeApi";
import {DeviceCommandDownQueueApi} from '@/api/property/DeviceCommandDownQueueApi';
import { message } from 'ant-design-vue';
import {BasaApi} from "@/api/property/basa/BasaApi";

export default {
  name: 'DeviceManagerdeviceBasaCommandStateMonitor',
  components: {
  },
  props: {
    data: Object
  },
  data() {
    return {
      loadRealtimeDataTimer : null,
      basaRealtimeData : {},

      readVersionLoading : false,
      readVersionTimer : null,

      setProfileNoneLoading : false,
      setProfileNoneTimer : null,

      readStatusLoading : false,
      readStatusTimer : null,

      setProfile1StartLoading : false,
      setProfile1StartTimer : null,

      setProfile1StopLoading : false,
      setProfile1StopTimer : null,

      setProfile2StartLoading : false,
      setProfile2StartTimer : null,

      setProfile2StopLoading : false,
      setProfile2StopTimer : null,

      setProfile3RampStartLoading : false,
      setProfile3RampStartTimer : null,

      setProfile3RampStopLoading : false,
      setProfile3RampStopTimer : null,

      setProfile3FrozenStartLoading:false,
      setProfile3FrozenStartTimer : null,

      setProfile3FrozenStopLoading : false,
      setProfile3FrozenStopTimer : null,

      setProfile3RefrigeratorStartLoading : false,
      setProfile3RefrigeratorStartTimer : null,

      setProfile3RefrigeratorStopLoading : false,
      setProfile3RefrigeratorStopTimer : null,

      setProfile3RoomTemperatureStartLoading : false,
      setProfile3RoomTemperatureStartTimer : null,

      setProfile3RoomTemperatureStopLoading : false,
      setProfile3RoomTemperatureStopTimer : null,

      setProfile4StartLoading : false,
      setProfile4StartTimer : null,

      setProfile4StopLoading : false,
      setProfile4StopTimer : null,

      connectColorstLoading : false,
      connectColorstTimer : null,

      disConnectColorstLoading : false,
      disConnectColorstTimer : null,

      readMalfunctionLoading:false,
      readMalfunctionTimer : null,

      readWarnningLoading : false,
      readWarnningTimer : null


    };
  },
  mounted() {
    this.getRealtimeData();
    this.loadRealtimeDataTimer = setInterval(this.getRealtimeData, 30000);


  },
  beforeUnmount() {
    clearInterval(this.loadRealtimeDataTimer);
  },
  methods: {
    getRealtimeData() {
      let that = this;
      BasaRealtimeApi.detail({"basaId" : that.data.basaId}).then(result => {
        let formatResult = result || {};
        let profile = '未知';
        if (formatResult.workStatus == 0) {
          profile = "none";
        } else if (formatResult.workStatus == 1) {
          profile = "profile1";
        } else if (formatResult.workStatus == 2) {
          profile = "profile2";
        } else if (formatResult.workStatus == 163) {
          profile = "profile3,ramp";
        } else if (formatResult.workStatus == 179) {
          profile = "profile3,Frozen";
        } else if (formatResult.workStatus == 195) {
          profile = "profile3,Refrigerator";
        } else if (formatResult.workStatus == 211) {
          profile = "profile3,room temperature";
        } else if (formatResult.workStatus == 4) {
          profile =  "profile4";
        }
        formatResult.profile = profile;
        that.basaRealtimeData = formatResult;
      });
    },

    checkProcess(sceneDictate, clearCallback, callback) {
      let params = {
        recordId: this.data.recordId,
        sceneDictate: sceneDictate
      };
      let result = DeviceCommandDownQueueApi.workingDetail(params);
      result
        .then(result => {
          if (!result || !result.dcdqId) { //处理完成了
            clearCallback && clearCallback(); //去掉菊花+清除循环调用
            callback && callback(); //用户自定义
          }
        })
        .catch(() => {
          clearCallback && clearCallback(); //去掉菊花+清除循环调用
        });
    },


    //----读取设备号
    clearReadVersionConfig(){
      this.readVersionLoading = false;
      clearInterval(this.readVersionTimer);
    },
    checkReadVersionConfig(){
      let that = this;
      this.checkProcess(1, this.clearReadVersionConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 -none
    clearSetProfileNoneConfig(){
      this.setProfileNoneLoading = false;
      clearInterval(this.setProfileNoneTimer);
    },
    checkSetProfileNoneConfig(){
      let that = this;
      this.checkProcess(2, this.clearSetProfileNoneConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 - profile1 Start
    clearProfile1StartConfig(){
      this.setProfile1StartLoading = false;
      clearInterval(this.setProfile1StartTimer);
    },
    checkProfile1StartConfig(){
      let that = this;
      this.checkProcess(3, this.clearProfile1StartConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 - profile1 Stop
    clearProfile1StopConfig(){
      this.setProfile1StopLoading = false;
      clearInterval(this.setProfile1StopTimer);
    },
    checkProfile1StopConfig(){
      let that = this;
      this.checkProcess(4, this.clearProfile1StopConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 - profile2 Start
    clearProfile2StartConfig(){
      this.setProfile2StartLoading = false;
      clearInterval(this.setProfile2StartTimer);
    },
    checkProfile2StartConfig(){
      let that = this;
      this.checkProcess(5, this.clearProfile2StartConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 - profile2 Stop
    clearProfile2StopConfig(){
      this.setProfile2StopLoading = false;
      clearInterval(this.setProfile2StopTimer);
    },
    checkProfile2StopConfig(){
      let that = this;
      this.checkProcess(6, this.clearProfile2StopConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 - profile3,Ramp Start
    clearProfile3RampStartConfig(){
      this.setProfile3RampStartLoading = false;
      clearInterval(this.setProfile3RampStartTimer);
    },
    checkProfile3RampStartConfig(){
      let that = this;
      this.checkProcess(7, this.clearProfile3RampStartConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 - profile3,Ramp Stop
    clearProfile3RampStopConfig(){
      this.setProfile3RampStopLoading = false;
      clearInterval(this.setProfile3RampStopTimer);
    },
    checkProfile3RampStopConfig(){
      let that = this;
      this.checkProcess(8, this.clearProfile3RampStopConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 - profile3,Frozen start
    clearProfile3FrozenStartConfig(){
      this.setProfile3FrozenStartLoading = false;
      clearInterval(this.setProfile3FrozenStartTimer);
    },
    checkProfile3FrozenStartConfig(){
      let that = this;
      this.checkProcess(9, this.clearProfile3FrozenStartConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 - profile3,Frozen stop
    clearProfile3FrozenStopConfig(){
      this.setProfile3FrozenStopLoading = false;
      clearInterval(this.setProfile3FrozenStopTimer);
    },
    checkProfile3FrozenStopConfig(){
      let that = this;
      this.checkProcess(10, this.clearProfile3FrozenStopConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 - profile3,Refrigerator start
    clearProfile3RefrigeratorStartConfig(){
      this.setProfile3RefrigeratorStartLoading = false;
      clearInterval(this.setProfile3RefrigeratorStartTimer);
    },
    checkProfile3RefrigeratorStartConfig(){
      let that = this;
      this.checkProcess(11, this.clearProfile3RefrigeratorStartConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 - profile3,Refrigerator stop
    clearProfile3RefrigeratorStopConfig(){
      this.setProfile3RefrigeratorStopLoading = false;
      clearInterval(this.setProfile3RefrigeratorStopTimer);
    },
    checkProfile3RefrigeratorStopConfig(){
      let that = this;
      this.checkProcess(12, this.clearProfile3RefrigeratorStopConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 - profile3,RoomTemperature Start
    clearProfile3RoomTemperatureStartConfig(){
      this.setProfile3RoomTemperatureStartLoading = false;
      clearInterval(this.setProfile3RoomTemperatureStartTimer);
    },
    checkProfile3RoomTemperatureStartConfig(){
      let that = this;
      this.checkProcess(13, this.clearProfile3RoomTemperatureStartConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 - profile3,RoomTemperature stop
    clearProfile3RoomTemperatureStopConfig(){
      this.setProfile3RoomTemperatureStopLoading = false;
      clearInterval(this.setProfile3RoomTemperatureStopTimer);
    },
    checkProfile3RoomTemperatureStopConfig(){
      let that = this;
      this.checkProcess(14, this.clearProfile3RoomTemperatureStopConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 - profile4 start
    clearProfile4StartConfig(){
      this.setProfile4StartLoading = false;
      clearInterval(this.setProfile4StartTimer);
    },
    checkProfile4StartConfig(){
      let that = this;
      this.checkProcess(15, this.clearProfile4StartConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 - profile4 stop
    clearProfile4StopConfig(){
      this.setProfile4StopLoading = false;
      clearInterval(this.setProfile4StopTimer);
    },
    checkProfile4StopConfig(){
      let that = this;
      this.checkProcess(16, this.clearProfile4StopConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 - get status
    clearReadStatusConfig(){
      this.readStatusLoading = false;
      clearInterval(this.readStatusTimer);
    },
    checkReadStatusConfig(){
      let that = this;
      this.checkProcess(17, this.clearReadStatusConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 10, 00
    clearDisConnectColorstConfig(){
      this.disConnectColorstLoading = false;
      clearInterval(this.disConnectColorstTimer);
    },
    disConnectColorstConfig(){
      let that = this;
      this.checkProcess(21, this.clearDisConnectColorstConfig, function(){
        that.getRealtimeData();
      });
    },
    //0x25 10, 01
    clearConnectColorstConfig(){
      this.connectColorstLoading = false;
      clearInterval(this.connectColorstTimer);
    },
    checkConnectColorstConfig(){
      let that = this;
      this.checkProcess(22, this.clearConnectColorstConfig, function(){
        that.getRealtimeData();
      });
    },
    //故障
    clearMalfunctionConfig(){
      this.readMalfunctionLoading = false;
      clearInterval(this.readMalfunctionTimer);
    },
    checkMalfunctionConfig(){
      let that = this;
      this.checkProcess(18, this.clearMalfunctionConfig, function(){
        that.getRealtimeData();
      });
    },
    //告警
    clearWarnningConfig(){
      this.readWarnningLoading = false;
      clearInterval(this.readWarnningTimer);
    },
    checkWarnningConfig(){
      let that = this;
      this.checkProcess(19, this.clearWarnningConfig, function(){
        that.getRealtimeData();
      });
    },


    addCommandToDevice(command) {
      let workerDetailParams = {
        recordId: this.data.recordId,
        sceneDictate: command
      };
      let that = this;
      let existWorkerResult = DeviceCommandDownQueueApi.workingDetail(workerDetailParams);
      existWorkerResult
        .then(workResult => {
          console.log(workResult);
          if (!workResult || !workResult.dcdqId) { //处理完成了
            that.pushCommandSubmit(command);
          } else {
            message.error('上一个配置还在推送中，请稍后重试');
            return;
          }
        })
        .catch((e) => {
          message.error(e);
        });
    },
    pushCommandSubmit(command) {
      this.loading = true;
      let updateDataRecord = {
        recordId: this.data.recordId,
        templateCode: 'basa',
        updateData: JSON.stringify({}),
        dictate : 0,
        sceneDictate : 6
      };
      if (command == 1) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 1; //读取版本
      } else if (command == 2) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 2; //0x25,0 none
      } else if (command == 3) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 3; //0x25, profile1 start
      } else if (command == 4) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 4; //0x25, profile1 stop
      } else if (command == 5) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 5; //0x25, profile2 start
      } else if (command == 6) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 6; //0x25, profile2 stop
      } else if (command == 7) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 7; //0x25, profile3,Ramp start
      } else if (command == 8) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 8; //0x25, profile3,Ramp stop
      } else if (command == 9) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 9; //0x25, profile3,Frozen start
      } else if (command == 10) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 10; //0x25, profile3,Frozen stop
      } else if (command == 11) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 11; //0x25, profile3,Refrigerator start
      } else if (command == 12) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 12; //0x25, profile3,Refrigerator stop
      } else if (command == 13) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 13; //0x25, profile3,RoomTemperature start
      } else if (command == 14) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 14; //0x25, profile3,RoomTemperature stop
      } else if (command == 15) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 15; //0x25, profile4, start
      } else if (command == 16) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 16; //0x25, profile4, stop
      } else if (command == 17) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 17; //0x25, get status
      } else if (command == 21) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 21; //0x25, 1000
      } else if (command == 22) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 22; //0x25, 1000
      } else if (command == 18) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 18; //故障
      } else if (command == 19) {
        updateDataRecord.dictate = 0;
        updateDataRecord.sceneDictate = 19; //告警
      }

      let result = DeviceCommandDownQueueApi.add(updateDataRecord);
      result
        .then(result => {
          this.loading = false;
          message.success(result.message);
          if (command == 1) {
            this.readVersionLoading = true; //转圈
            this.readVersionTimer = setInterval(this.checkReadVersionConfig, 5000);
          } else if (command == 2) {
            this.setProfileNoneLoading = true; //转圈
            this.setProfileNoneTimer = setInterval(this.checkSetProfileNoneConfig, 5000);
          } else if (command == 3) {
            this.setProfile1StartLoading = true; //转圈
            this.setProfile1StartTimer = setInterval(this.checkProfile1StartConfig, 5000);
          } else if (command == 4) {
            this.setProfile1StopLoading = true; //转圈
            this.setProfile1StopTimer = setInterval(this.checkProfile1StopConfig, 5000);
          } else if (command == 5) {
            this.setProfile2StartLoading = true; //转圈
            this.setProfile2StartTimer = setInterval(this.checkProfile2StartConfig, 5000);
          } else if (command == 6) {
            this.setProfile2StopLoading = true; //转圈
            this.setProfile2StopTimer = setInterval(this.checkProfile2StopConfig, 5000);
          } else if (command == 7) {
            this.setProfile3RampStartLoading = true; //转圈
            this.setProfile3RampStartTimer = setInterval(this.checkProfile3RampStartConfig, 5000);
          } else if (command == 8) {
            this.setProfile3RampStopLoading = true; //转圈
            this.setProfile3RampStopTimer = setInterval(this.checkProfile3RampStopConfig, 5000);
          } else if (command == 9) {
            this.setProfile3FrozenStartLoading = true; //转圈
            this.setProfile3FrozenStartTimer = setInterval(this.checkProfile3FrozenStartConfig, 5000);
          } else if (command == 10) {
            this.setProfile3FrozenStopLoading = true; //转圈
            this.setProfile3FrozenStopTimer = setInterval(this.checkProfile3FrozenStopConfig, 5000);
          } else if (command == 11) {
            this.setProfile3RefrigeratorStartLoading = true; //转圈
            this.setProfile3RefrigeratorStartTimer = setInterval(this.checkProfile3RefrigeratorStartConfig, 5000);
          } else if (command == 12) {
            this.setProfile3RefrigeratorStopLoading = true; //转圈
            this.setProfile3RefrigeratorStopTimer = setInterval(this.checkProfile3RefrigeratorStopConfig, 5000);
          } else if (command == 13) {
            this.setProfile3RoomTemperatureStartLoading = true; //转圈
            this.setProfile3RoomTemperatureStartTimer = setInterval(this.checkProfile3RoomTemperatureStartConfig, 5000);
          } else if (command == 14) {
            this.setProfile3RoomTemperatureStopLoading = true; //转圈
            this.setProfile3RoomTemperatureStopTimer = setInterval(this.checkProfile3RoomTemperatureStopConfig, 5000);
          } else if (command == 15) {
            this.setProfile4StartLoading = true; //转圈
            this.setProfile4StartTimer = setInterval(this.checkProfile4StartConfig, 5000);
          } else if (command == 16) {
            this.setProfile4StopLoading = true; //转圈
            this.setProfile4StopTimer = setInterval(this.checkProfile4StopConfig, 5000);
          } else if (command == 17) {
            this.readStatusLoading = true; //转圈
            this.readStatusTimer = setInterval(this.checkReadStatusConfig, 5000);
          } else if (command == 21) {
            this.disConnectColorstLoading = true; //转圈
            this.disConnectColorstTimer = setInterval(this.disConnectColorstConfig, 5000);
          } else if (command == 22) {
            this.connectColorstLoading = true; //转圈
            this.connectColorstTimer = setInterval(this.checkConnectColorstConfig, 5000);
          } else if (command == 18) {
            this.readMalfunctionLoading = true; //转圈
            this.readMalfunctionTimer = setInterval(this.checkMalfunctionConfig, 5000);
          } else if (command == 19) {
            this.readWarnningLoading = true; //转圈
            this.readWarnningTimer = setInterval(this.checkWarnningConfig, 5000);
          }
        })
        .catch(() => {
          this.loading = false;
        });
    },
    cancelIOTAuto() {
      BasaApi.iotAction({"action" : "add"}).then(result => {
        message.success("成功")
      });
    },
    addIotAuto() {
      BasaApi.iotAction({"action" : "del"}).then(result => {
        message.success("成功")
      });
    },
  }
};
</script>
<style scoped>
.block-space-top {
  /*上右下左*/
  padding: 10px 0 0 0;
}

.block-space-right {
  padding: 0 5px 0 0;
}

.block-space-left {
  padding: 0 0 0 5px;
}

.card-width {
  width: 100%;
}
@media screen and (max-width: 880px) {
  .analysis-tabs-extra {
    display: none;
  }
}
</style>
